package com.plian.system.service.im;

import com.plian.Tools.pagedata.PageData;
import com.plian.system.dto.im.BaseInvestmentPlanDTO;
import com.plian.system.entity.im.BaseInvestmentPlan;
import com.plian.system.entity.pm.propertyinformation.PropertyTime;
import com.plian.system.excel.ImportResult;
import com.plian.system.model.R;
import com.plian.system.mybatis.base.BaseService;
import com.plian.system.vo.im.BaseInvestmentPlanVO;
import com.plian.system.vo.im.InvestmentPlanSummaryVO;
import com.plian.system.vo.im.InvestmentUnitSummaryVO;
import com.plian.system.vo.report.ChartsVO;

import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.concurrent.Future;

/**
 * 服务类
 *
 * @author
 * @since 2019-09-27
 */
public interface IBaseInvestmentPlanService extends BaseService<BaseInvestmentPlan> {

    /**
     * 每年只能填写一次
     * @param baseInvestmentPlan
     * @return
     */
    String checkYear(BaseInvestmentPlan baseInvestmentPlan);

    /**
     * 保存 包含子表
     * @param baseInvestmentPlan
     * @return
     */
    boolean submit(BaseInvestmentPlan baseInvestmentPlan);

    /**
     * 获取detail obj对象
     * @param baseInvestmentPlan
     * @return
     */
    R<BaseInvestmentPlanVO> getDetailObj(BaseInvestmentPlan baseInvestmentPlan);

    /**
     * 项目投资计划汇总
     * @param filingUnitId
     * @param filingYear
     * @return
     */
    List<InvestmentPlanSummaryVO> summary(String filingUnitId, String filingYear);

    /**
     *  校验单位和年度
     * @param baseInvestmentPlan
     * @return
     */
    String checkSummary(BaseInvestmentPlan baseInvestmentPlan);

    /**
     * 市属国有企业投资计划汇总表
     * @param baseInvestmentPlanDTO
     * @return
     */
    List<InvestmentUnitSummaryVO> unitSummary(BaseInvestmentPlanDTO baseInvestmentPlanDTO);

    /**
     *  生成excel文件 并返回文件名  时间戳+"-"+uuid
     * @param baseInvestmentPlanId
     * @return
     */
    String export(Long baseInvestmentPlanId);

    /**
     *  生成可以导入的excel文件 并返回文件名  时间戳+"-"+uuid
     * @param baseInvestmentDeptId
     * @return
     */
    String exportImportFile(Long baseInvestmentDeptId);

    /**
     * excel文件下载
     * @param key
     * @param response
     */
    void download(String key, HttpServletResponse response);

    /**
     * 项目投资计划导入
     * @param progressId
     * @param inputStream
     * @return
     */
    Future<ImportResult> importExcel(String progressId, InputStream inputStream);

    /**
     * 导入模板下载
     * @param response
     * @param os
     */
    void exportTemplateExcel(HttpServletResponse response, OutputStream os);

    /**
     * 年度项目投资计划柱状图
     * @param baseInvestmentPlanDTO
     * @return
     */
    ChartsVO statisticsCompany(BaseInvestmentPlanDTO baseInvestmentPlanDTO);

    List<PageData> findInvestListByDateCreate(PropertyTime propertyTime) ;

    String saveInvestmentPlan(String data);
}
